<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="../../app/js/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="../../app/css/footer.css" />
		<link rel="stylesheet" href="../../app/css/lystyle.css" />
		<link rel="stylesheet" type="text/css" href="../../app/css/backstage.css" />

		<style type="text/css">
			/*修改底部字体颜色*/
			
			.foot:nth-child(2) {
				color: #e83023;
			}
			
			#wrap div#content {
				padding-top: 1.2rem;
			}
		</style>
		<script src="../../app/js/flexible.min.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<div id="wrap">
			<div id="main">
				<div id="header">
					<a id="headImg" href="backstage_index.html"><img class="headImg" src="../../app/images/12.png" /></a>
					<a href="../../app/view/personage/person_cashform.html" class="ly-headright">提现</a>
					<p id="headTitle">资产</p>
				</div>
				<div id="content">
					<ul class="ly-li12">
						<li>
							<a><span>本月收入：<span id="money1"></span>仁和币(截止今日<span>0点</span>)</span>
							</a>
						</li>
						<li>
							<a><span>商家本月收入：<span id="money2">0</span>仁和币</span>
							</a>
						</li>
						<li>
							<a><span>仁和币余额：<span id="money3"></span>仁和币</span>
							</a>
						</li>
						<li>
							<a><span>分润比例：<span id="money4">32%</span></span>
							</a>
						</li>
						<li>
							<a><span>
								<span id="type">仁和币状态：</span>
								<img style="float: right;padding-top:0.33rem;padding-right: 0.33rem;" src="../../app/images/coalltion/btn2.png" /></span>
							</a>
						</li>
					</ul>
				</div>
				<a href="backstage_trade.html">
					<p class="ly-borderp" style="">交易记录</p>
				</a>

			</div>

		</div>

	</body>
	<script src="../../app/js/jquery-2.2.3.min.js"></script>
	<script type="text/javascript" src="../../app/js/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
	<script src="../../app/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var tokenReztApp = $.cookie("tokenReztApp");
		if(!tokenReztApp) {
			window.location.href = "../../app/view/login/login/login.html";
		}
		$(function() {
			currentyf();
		});

		//用户信息
		var user, role, goodsId;
		//获取当前会员信息
		function currentyf() {
			$.ajax({
				cache: false,
				type: "GET",
				url: "http://47.104.13.109/member-service/auth/current?token=" + tokenReztApp,
				dataType: "JSON",
				async: false,
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					$.removeCookie('tokenReztApp', {
						expires: 7,
						path: '/'
					});
					$.removeCookie("tokenRh", {
						expires: 7,
						path: '/'
					});
					$.removeCookie('memberId', {
						expires: 7,
						path: '/'
					});
					$.removeCookie('roleId', {
						expires: 7,
						path: '/'
					});
					window.location.href = "../../app/view/login/login/login.html";
				},
				success: function(data) {
					var check = true;
					for(var i = 0; i < data.roleList.length; i++) {
						var roles = data.roleList[i].id;
						var deadline = new Date(data.roleList[i].deadline);
						if(roles == "f2" && deadline >= new Date()) {
							check = false;
							role = roles; //角色
						}
					}
					if(check) {
						alert("权限不足，请升级为创客！");
						window.location.href = "../../app/view/login/login/login.html";
					}
					user = data.loginName;
					goodsId = data.id;
				}
			});
		}

		$(function() {
			$.ajax({
				type: "post",
				url: "http://47.104.13.109/coin-service/coin/search2",
				async: true,
				data: {
					"rhObject": goodsId
				},
				success: function(data) {
					//							console.log(data);
					//状态 
					if(data.rhStatus == 0) {
						$("#type").text("仁和币状态:正常");
					}
					if(data.rhStatus == -1) {
						$("#type").text("仁和币状态:已锁定");
					}
					$('#money3').html(data);
				}
			});
			var m1 = 0;
			var m2 = 0;
			$.ajax({
				type: "get",
				url: "http://47.104.13.109/coin-service/coinVariation/income",
				async: true,
				data: {
					"rhObject": goodsId,
					"rhType": "member"
				},
				success: function(data) {
					m1 = data;
					$.ajax({
						type: "get",
						url: "http://47.104.13.109/coin-service/coinVariation/income",
						async: true,
						data: {
							"rhObject": goodsId,
							"rhType": "user"
						},
						success: function(data) {
							m2 = data;
							$('#money1').html(m1*1+m2*1);
						}
					});
				}
			});
			$.ajax({
				type:"post",
				url:"http://47.104.13.109:80/coin-service/coin/searchLists?rhObject="+goodsId,
				async:true,
				success:function(data){
					$("#money2").html(data.toFixed(2));
				},
				error:function(error){
					alert("查询商家收入时失败");
				}
			});
		})
	</script>

</html>